import java.util.Random;
public class Test2 {
    public static void main(String[] args) {
        System.out.print("随机验证码：");
        System.out.print(creatCode(4));
    }
    public static String creatCode (int n){
        String code = "";
        String str = "1234567890qwertyuioplkjhgfdsazxcvbnmMNBVCXZLKJHGFDSAQWERTYUIOP";
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            int num = random.nextInt(str.length());
            char c = str.charAt(num);
            code += c;
        }
        return code;
    }
}